class CreateEnrollments < ActiveRecord::Migration
  def self.up
    create_table :enrollments do |t|
      t.string :actived, :limit => 1, :null => false, :default => "N"
      t.references :user, :null => false
      t.references :course, :null => false

      t.timestamps
    end
    add_index(:enrollments,[:user_id, :course_id], :unique => true, :name => "uk_user_course")
  end

  def self.down
    drop_table :enrollments
  end
end
